<?php

/**
 * BbMatch form base class.
 *
 * @method BbMatch getObject() Returns the current form's model object
 *
 * @package    vogue
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBbMatchForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'm_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BbMatchday'), 'add_empty' => true)),
      'team1_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BbTeams'), 'add_empty' => false)),
      'team2_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BbTeams_2'), 'add_empty' => false)),
      'score1'       => new sfWidgetFormInputText(),
      'round1score1' => new sfWidgetFormInputText(),
      'round2score1' => new sfWidgetFormInputText(),
      'round3score1' => new sfWidgetFormInputText(),
      'round4score1' => new sfWidgetFormInputText(),
      'score2'       => new sfWidgetFormInputText(),
      'round1score2' => new sfWidgetFormInputText(),
      'round2score2' => new sfWidgetFormInputText(),
      'round3score2' => new sfWidgetFormInputText(),
      'round4score2' => new sfWidgetFormInputText(),
      'match_descr'  => new sfWidgetFormTextarea(),
      'published'    => new sfWidgetFormInputCheckbox(),
      'is_extra'     => new sfWidgetFormInputCheckbox(),
      'm_played'     => new sfWidgetFormInputCheckbox(),
      'm_date'       => new sfWidgetFormDateTime(),
      'm_time'       => new sfWidgetFormInputText(),
      'm_location'   => new sfWidgetFormInputText(),
      'bonus1'       => new sfWidgetFormInputText(),
      'bonus2'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'm_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BbMatchday'), 'required' => false)),
      'team1_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BbTeams'), 'required' => false)),
      'team2_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BbTeams_2'), 'required' => false)),
      'score1'       => new sfValidatorInteger(array('required' => false)),
      'round1score1' => new sfValidatorInteger(array('required' => false)),
      'round2score1' => new sfValidatorInteger(array('required' => false)),
      'round3score1' => new sfValidatorInteger(array('required' => false)),
      'round4score1' => new sfValidatorInteger(array('required' => false)),
      'score2'       => new sfValidatorInteger(array('required' => false)),
      'round1score2' => new sfValidatorInteger(array('required' => false)),
      'round2score2' => new sfValidatorInteger(array('required' => false)),
      'round3score2' => new sfValidatorInteger(array('required' => false)),
      'round4score2' => new sfValidatorInteger(array('required' => false)),
      'match_descr'  => new sfValidatorString(),
      'published'    => new sfValidatorBoolean(array('required' => false)),
      'is_extra'     => new sfValidatorBoolean(array('required' => false)),
      'm_played'     => new sfValidatorBoolean(array('required' => false)),
      'm_date'       => new sfValidatorDateTime(array('required' => false)),
      'm_time'       => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'm_location'   => new sfValidatorString(array('max_length' => 255)),
      'bonus1'       => new sfValidatorNumber(array('required' => false)),
      'bonus2'       => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bb_match[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BbMatch';
  }

}
